The number of trades works exactly like the number of coins.
On FireRed, LeafGreen and Emerald it has to be XORed with the lower byte of the security key.
On Ruby and Sapphire the value is just there, since there is no security key.

Here are the locations of the trades number values in the included saves:

FireRed		--->	0x192D4
LeafGreen	--->	0xF2D4
Emerald		--->	0x2670
Sapphire	--->	0x1B614